module WWW
  class Tkd
    class Status < ActiveRecord::Base
      def self.save_from_info status
        if self.find_by_no_and_hash_code  status.no,status.hash_code
          status.save
          #更新express状态，标识该信息有最新的信息,TODO 这里需要完善,即最新情况如何通知用户
          WWW::Tkd::Express.update_new_status(status.agent_id,status.no)
        end
      end
      def self.find_form_agent_id_and_no(agent_id,no)

        self.find(:all,
        :conditions => "agent_id = #{agent_id} and no='#{no}'",        
:order => "happen_time desc")

      end
    end
  end
end
